package com.yh.csx.bsf.ods.clickhouse;

import java.util.Set;

import lombok.Data;
import ru.yandex.clickhouse.domain.ClickHouseDataType;

/**
 * Clickhouse 表引擎
 * @author Robin.Wang
 * @date	2020-05-14
 * */
@Data
public class ClickhouseTable {

	/**
	 * 表名 
	 * */
	private String tableName;
	/**
	 * 引擎
	 * */
	private String engine;
	/**
	 * 主键
	 * */
	private Set<String> ids;
	
	
	@Data
	public static class ClickHouseColumn{
		
		/**
		 * 	列名
		 * */
		private String name;
		/**
		 * 	类型
		 * */
		private ClickHouseDataType type;
		/**
		 * 	精度
		 * */
	    private int precision;
	    /**
	     * 	长度
	     * */
	    private int scale;
	    /**
	     * 	值
	     * */
	    private Object value;
	    /***
	     * 	是否允许为空
	     * */
		private boolean isNull;
		
		private boolean isKey = false;
		
		private boolean updated;
		/**
		 * 	默认值
		 * */
		private Object defaultValue;		
		
		public ClickHouseColumn(String name, ClickHouseDataType type, Object value) {
			super();
			this.name = name;
			this.type = type;
			this.value = value;
		}
		
		public ClickHouseColumn(String name, ClickHouseDataType type, int precision, int scale, boolean isNull,boolean isKey,boolean updated,
				Object value,String defaultValue) {
			super();
			this.name = name;
			this.type = type;
			this.precision = precision;
			this.scale = scale;
			this.isNull = isNull;
			this.isKey = isKey;
			this.updated = updated;
			this.value = value;
			this.defaultValue = defaultValue;
		}
		
		
	}
}
